# coding=utf-8
"""
Project:AI
File:main.py
Author:whtry陈
Time:2021-03-27 09:47
"""

from jieba import lcut
from time import localtime, strftime


def get_clock():
    now_time = int(strftime("%H", localtime()))
    if 1 <= now_time < 6:
        return "凌晨"
    elif 6 <= now_time < 9:
        return "早晨"
    elif 9 <= now_time < 13:
        return "中午"
    elif 13 <= now_time < 18:
        return "下午"
    elif 18 <= now_time < 23:
        return "晚上"
    elif 23 <= now_time < 1:
        return "深夜"


class FQG:
    def __init__(self):
        self.name = "逢妻光"
        self.num = 0
        self.mood = "peace"  # peace 平静 angry 生气
        self.dialogue = []

    def print_apis(self, things):
        """
        方便日后加gui的输出
        :param things: 需要输出的内容
        :return:
        """
        print(things)

    def answer(self, reply=""):
        """
        ai在得到回答后的反馈，刚开机时会自动问好
        :param reply: 用户上一反馈的回答
        :return:
        """
        if self.num == 0:
            self.print_apis("{}好,主人".format(get_clock()))
            self.num += 1
        elif reply == "":
            pass

    def get_answer(self, answer):
        """
        将
        :param answer:
        :return:
        """
        print("数据库:", self.dialogue)
        after_cut = lcut(answer)
        print(after_cut)

    def main(self):
        self.answer()
        # self.get_answer()


ai = FQG()
ai.main()
